import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  BaseEntity,
  Index,
  OneToOne,
  JoinColumn,
  OneToMany,
} from 'typeorm';
import FileEntity from './file.entity';
@Entity('app')
export default class AppEntity extends BaseEntity {
  @PrimaryGeneratedColumn('increment', { type: 'bigint', comment: 'id编号' })
  id: number;

  @Column({ type: 'text', comment: '文件名字' })
  name: string;

  @OneToOne((type) => FileEntity, { cascade: ['update'] })
  @JoinColumn({ name: 'fileId' })
  file: FileEntity;

  @Column({
    type: 'tinyint',
    nullable: true,
    comment: '文件类型，1:ios，2:android',
  })
  systemType: number;

  @Column({
    type: 'tinyint',
    nullable: true,
    comment: 'app类型，1:学员 2:教练',
  })
  appType: number;

  @Column({ type: 'text', comment: '上传日期' })
  uploadTime: string;

  @Index()
  @Column({ type: 'bigint', nullable: true, comment: '上传人信息' })
  personId: number;

  @Column({ type: 'text', nullable: true, comment: '文件描述' })
  desc: string;

  @Column({ type: 'text', comment: '文件版本' })
  version: string;

  @Column({ type: 'text', comment: 'build版本' })
  build: string;
}
